package cn.rongdao.jrkabao.model.takephoto;

import com.mifengkong.frtools.http.request.HttpFunction;
import com.mifengkong.frtools.util.FRString;

import java.util.Map;

import cn.rongdao.jrkabao.bean.takephoto.BankCardOCRBean;
import cn.rongdao.jrkabao.model.api.BaseKaMaoModel;
import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by jack on 2018/4/18
 */

public class BankCardOCRModel extends BaseKaMaoModel {

    public static BankCardOCRModel getInstance() {
        return getPresent(BankCardOCRModel.class);
    }

    public BankCardOCRModel addParam(String key, Object value) {
        if (!FRString.isEmpty(key)) {
            mParams.put(key, value);
        }
        return this;
    }

    public BankCardOCRModel addParam(Map<String, String> map) {
        if (null != map && map.size() > 0) {
            mParams.putAll(map);
        }
        return this;
    }

    public void execute(Observer<BankCardOCRBean> observer) {
        Observable<BankCardOCRBean> observable = mServletApi.bankCardOCR(mParams).map(new HttpFunction<BankCardOCRBean>());
        toSubscribe(observable, observer);
    }
}
